package model;

import java.util.List;

/**
 * Email Template place holder
 */
public class Template
{
	private String templateName;
    private String subject;
    private String message;
    private List<String> to;
    private String fileName;
    
    /**
     * Default constructor
     */
    public Template()
    {
 
    }
    
    /**
     * Constructor
     * @param templateName Name of the template as string
     * @param subject Subject of the template as string
     * @param message Message in the template as string
     * @param receiverList Receiver as string list
     */
    public Template(String templateName, String subject, String message, List<String> receiverList)
    {
        this.templateName = templateName;
        this.subject = subject;
        this.message = message;
        this.to = receiverList;
    }
    
	/**
	 * This method will return the template name
	 * @return return the template name
	 */
	public String getTemplateName()
    {
        return templateName;
    }

    /**
     * This method will return subject of the template as string
     * @return return subject of the template as string
     */
    public String getSubject()
    {
        return subject;
    }


    /**
     * This method will take subject as parameters to update the subject in filed in template
     * @param subject the updated the subject in template
     */
    public void updateSubject(String subject)
    {
        this.subject = subject;
    }


    /**
     * This will return message in template
     * @return return the message in template
     */
    public String getMessage()
    {
        return message;
    }


    /**
     * update the given message
     * @param message the updated message
     */
    public void updateMessage(String message)
    {
        this.message = message;
    }


    /**
     * This method will return to list of receiver(s)
     * @return This method will return to list of receivers in the template
     */
    public List<String> getTo()
    {
        return to;
    }

    /**
     * set the receiver(s)
     * @param to list of the receiver(s)
     */
    public void setTo(List<String> to)
    {
        this.to = to;
    }
		
	
	/**
	 * Returns the name of the file based on the name provided for the template, replace spaces with underscore
	 * @return return the file name
	 */
	public String getFileName()
	{
	    fileName = this.templateName.replaceAll("\\s", "_"); 
		return fileName;
	}
}
